<template>
    <view class="container" :style="themeColor">
        <header-bar :config="config"></header-bar>
        <product-temp
            :tempType="0"
            :isOnShow="isOnShow"
            @upCart="upCart"
            :productTagId="productTagId"
            :supplierId="supplierId"></product-temp>
    </view>
</template>

<script>
import productTemp from "@/pages_supplier/packet/supplier/detailTemp.vue"
import storage from "@/uni-sub-base/utils/storage.js"
import { getUserCarList } from "@/utils/cartUtil.js"
export default {
    components: {
        productTemp,
    },
    data() {
        return {
            config: {
                title: "店铺详情",
                back: true,
                color: ["#ffffff"],
                centerSlot: true,
                barPlaceholder: true,
            },
            isOnShow: true,
            productTagId: "",
            supplierId: 0,
        }
    },
    methods: {
        upCart(isOnShow) {
            this.isOnShow = isOnShow
            //离开页面 同步购物车  TODO 增加条件 有变更 再同步
            getUserCarList().then((res) => {
                this.isChangeCart = false
            })
        },
    },
    onLoad(e) {
        this.supplierId = Number(e.id)
    },
    created() {
        this.config.backgroundColor = [1, this.getThemeColor]
    },
    mounted() {
        let webInfo = storage.getCache("webInfo")
    },
    onShow() {
        this.upCart(true)
    },
    onHide() {
        this.upCart(false)
    },
    computed: {},
}
</script>

<style lang="scss"></style>
